<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
    <include file="Public:aside"/>
</block>

<block name="main">

    <div class="table-toolbar">
        <a href="{:U('Kefu/add')}" class="btn btn-sm btn-primary">添加</a>
        <a class="btn btn-sm btn-primary" onclick="myform.action='{:U('Kefu/listorder')}';$('#myform').submit();">排序</a>
    </div>

    <div class="row table-container">
        <div class="col-md-12">
            <form name="myform" id="myform" action="" method="post">
                <table class="table table-bordered table-hover">
                    <thead>
                    <tr>
                        <th width="30"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
                        <th class="w-50">排序</th>
                        <th>名称</th>
                        <th>类别</th>
                        <th>代码</th>
                        <th class="w-200">管理操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <empty name="list">
                        <tr class="table-data-empty">
                            <td class="text-center empty-info" colspan="8">
                                <i class="fa fa-database"></i> 暂时没有数据<br>
                            </td>
                        </tr>
                        <else/>
                    <volist name="list" id="vo" key="k">
                        <tr>
                            <td width="30" align="center"><input class="inputcheckbox" name="ids[]" value="{$vo['id']}" type="checkbox" ></td>
                            <td width="40" align='center'><input name='listorders[{$vo.id}]' type='text' size='3' value='{$vo.listorder}' class='input-text-c'></td>

                            <td>{$vo['name']}</td>
                            <td>
                                <eq name="vo.type" value="1">QQ</eq>
                                <eq name="vo.type" value="2">旺旺</eq>
                                <eq name="vo.type" value="3">Skype</eq>
                                <eq name="vo.type" value="4">电话</eq>
                            </td>
                            <td>
                                {$vo['code']|stripcslashes}
                            </td>
                            <td>
                                <a class="btn btn-xs btn-primary" href="{:U('Kefu/edit',array('id'=>$vo['id']))}">编辑</a>
                                <a class="btn btn-xs btn-danger" href="javascript:confirm_delete('{:U('Kefu/delete',array(id=>$vo['id']))}')">删除</a>
                            </td>
                        </tr>
                    </volist>
                    </empty>
                    </tbody>
                </table>

                <div class="row">
                    <div class="pull-right" id="pages">{$page}</div>
                </div>
            </form>
        </div>
    </div>

<script type="text/javascript">
    $(document).ready(function() {
        $('#myform').ajaxForm({
            success:  complete,  // post-submit callback
            dataType: 'json'
        });
    });

    function complete(data){
        if(data.status==1){
            layer.msg('修改成功');
        }else{
            layer.msg(data.info);
        }

    }
</script>
</block>